<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>麦知网——学问有余，可为人师</title>

<!-- Bootstrap core CSS -->
<link href="../../css/bootstrap.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="../../css/non-responsive.css" rel="stylesheet">

<link href="../../css/courseCreate.css" rel="stylesheet">    
<link href="../../css/font-awesome.min.css" rel="stylesheet">
 
 
 	
	
	<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
	<script src="../../js/jquery.min.js"></script>
	<script src="../../js/logout.js"></script>
	<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
	<script src="../../js/bootstrap.js"></script>
	<script src="../../js/logout.js"></script>
	<script type="text/javascript">
/*	function change_list(a)
	{
		$("#case1").css("display","none");
		$("#case2").css("display","none");
		$("#case3").css("display","none");
		$("#case4").css("display","none");
		$("#a1").attr("class","list-group-item");
		$("#a2").attr("class","list-group-item");
		$("#a3").attr("class","list-group-item");
		$("#a4").attr("class","list-group-item");
		$("#case"+a).css("display","block");
		$("#a"+a).attr("class","active list-group-item");
	}




	function typeLabels(a)
	{
		var textvalue=$("#textvalue").val();
		$(".typeLabel3"+a).attr("class","typeLabel1"+a);
		var typeLabel1=$(".typeLabel1"+a);
		var typeLabel2=$(".typeLabel2"+a);
		typeLabel1.css("background-color","#D0D1E6");
		typeLabel2.css("background-color","#F2F2F2");
		typeLabel2.attr("class","typeLabel3"+a);
		typeLabel1.attr("class","typeLabel2"+a);
	//第一次点击 加上这个分类名
		if($('.typeLabel2'+a+'>a').html())
		{
			$("#textvalue").val(textvalue+$('.typeLabel2'+a+'>a').html());
		}
	//第二次点击 减去这个分类名
		if($('.typeLabel3'+a+'>a').html())
		{
			var strPosition=textvalue.indexOf($('.typeLabel3'+a+'>a').html());
			var textNew1=textvalue.substr(0,strPosition);
			var textNew2=textvalue.substr(strPosition+$('.typeLabel3'+a+'>a').html().length,textvalue.length);
			//var textjiechu=textvalue.substr(strPosition,strPosition+$('.typeLabel3'+a+'>#a').html().length);
			var textNew=textNew1+textNew2;
			$("#textvalue").val(textNew);
		}
	}

*/


	
		
	
	</script>
</head>
<body>
	{% include 'public/common/header.html' %}
	<div class="container" style="margin-top:45px">
		<div class="row">
<!-- left div -->
			<div class="col-xs-8">
				<div>
					<div class="publisher_img pull-left">
						<img src="{{info.domain}}/{{info.img}}" width="100%" class="img-circle"/>
					</div>
					<div class="publisher_name pull-left">
						<div class="cc_title"><b>创建{{user_name}}的悬赏</b></div>
						<div class="publisher_sign"><i>{{user_name}}一共创建了{{rewardscount}}条悬赏</i></div>
					</div>
					<div class="clearfix"></div>
				</div>
				<div>
					<div class="topdirection"></div>
					<div class="group_mes">
					<form action="{% url 'rewards:addReward' %}" id="form" method="post" enctype="multipart/form-data">
						{% csrf_token %}
						<div class="group_form_all">
							<div class="group_form_name pull-left"> 求购课程名 </div>
							<div class="group_form pull-left"><input type="text" id='courseName' maxlength="12" name="course_name" class="form-control"></div>
							<div id='aletName'></div>
							<div class="clearfix"></div>
						</div>
						<div class="group_form_all">
							<div class="group_form_name pull-left"> 求购课程描述 </div>
							<div class="group_form pull-left"><textarea id="course_intro" name="course_intro" class="form-control group_textarea"></textarea></div>
							<div class="clearfix"></div>
						</div>
						<div class="group_form_all">
							<div class="group_form_name pull-left"> 悬赏金额 </div>
							<div class="group_form pull-left">
								<div class="input-group">
								  <span class="input-group-addon">￥</span>
								  <input type="text" id="price" name="price" class="form-control">
								  <span class="input-group-addon">.00</span>
								</div>
							</div>
							<div class="clearfix"></div>
						</div>
						<div class="group_form_all">
<!-- 标签设置  -->	
							<div class="right case4" id="case4">
								<div class="group_form_all">
									<div class="group_form_name pull-left"> 课程分类 </div>
									<div class="group_form pull-left">
										<select name="belongtype" class="form-control">
<!-- 循环显示分类标签 开始处 -->{% for t in types %}
											<option value="{{t.id}}">{{t.name}}</option>
<!-- 循环显示分类标签 结束处 -->{% endfor %}
											<div class="clearfix"></div>						
										</select>
									</div>
									<div class="clearfix"></div>							
									<div class="subbox">
										<input id="subbox" type="checkbox" onclick="sub()" checked>我已阅读并同意<a href="{% url 'users:agreement' 3 %}" target="_blank">麦知网课程协议</a>
									</div>
									<div>
										<div style="text-align:center;"><button id="subbutton3" type="button" onclick="refer()" class="btn btn-info">创建悬赏</button></div>
									</div>
								</div>
							</div>
<!-- 标签设置 结束处 -->

						</div>
					</form>
					</div>
				</div>
			</div>
<!-- 中间留白div -->

<!-- right div -->
			<div class="col-xs-4">
				<div class="agreement">
					<pre>
麦知提倡:

1. 平等、尊重和自由；
2. 宽容和理性地对待不同的看法、喜好和意见；
3. 尊重他人的隐私和个人空间。
麦知反对:

1. 针对种族、国家、民族、宗教、性别、年龄、地缘、性取向、生理特征的歧视和仇恨言论；
2. 不雅词句、人身攻击、故意骚扰和恶意使用；
3. 色情、激进时政、意识形态方面的话题。
麦知杜绝:

1. 违反中国或麦知成员所在地法律法规的行为和内容（相关政策法规）；
2. 威胁他人或麦知成员自身的人身安全、法律安全的行为；
3. 对网站的运营安全有潜在威胁的内容。
					</pre>
				</div>
			</div>
		</div>
	</div>
	
<script type="text/javascript">
	//必须选定 我已阅读并同意麦知网课程协议 才能创建悬赏
	function sub(){
		$("#subbutton3").attr("id","subbutton1");
		$("#subbutton2").removeAttr("disabled");
		$("#subbutton1").attr("disabled","disabled");
		$("#subbutton2").attr("id","subbutton3");
		$("#subbutton1").attr("id","subbutton2");
	}

	//表单提交
	function refer(){
		var courseName=document.getElementById('courseName').value;
		var price=document.getElementById('price').value;
		var course_intro=document.getElementById('course_intro').value;
		
		if (courseName=='') {
			alert('请输入课程名！');		
			return ;
		} if (course_intro=='') {
			alert('请输入课程介绍');		
			return ;
		} if (price=='' || isNaN(price)) {
			alert('请输入正确的价格，价格必须为数字');		
			return ;
		} else {
			var form = document.getElementById('form');  
		    	form.submit();	
		}
		 
	}
</script>
</body>
</html>
